package com.yx.backstage.enums;

/**
 * @author YangXiong
 */

public enum Sex {

    MAN(1, "男"),
    WOMAN(2, "女"),
    NON(3, "未知"),
    ;
    public final Integer key;
    public final String value;

    Sex(Integer key, String value) {
        this.key = key;
        this.value = value;
    }

    public static String getValueByKey(Integer k) {
        for (Sex sex : Sex.values()) {
            if (k.equals(sex.key)) {
                return sex.value;
            }
        }
        return "";
    }

    public static Integer getKeyByValue(String v) {
        for (Sex sex : Sex.values()) {
            if (v.equals(sex.value)) {
                return sex.key;
            }
        }
        return 3;
    }
}
